auto

The auto keyword is used to define automatic variables. The type of variable can be a scalar variable, a VECTOR or a String, depending on the upper-lower case letters in the variable name. The scope of auto variables is delimited by braces as in C. All auto variables are stored on the stack and are freed when the scope of the variable is left. Definition of variables can only be done right after a brace has been opened. Only scalar variables can be assigned as the are defined, while vectors are assigned to zero, and strings are empty. Contrarily to C, automatic scalar variables are set to zero if not assigned. auto is a C-calculator mode keyword.

auto var-list

     # Some dummy examples
     set data 100
     cmode
        x = y = 1                # These (x, y) are global
        X = y++                  # As well as vector X
        { auto x=2, X, Y         # All these variables are local...
           X=3; Y=sin(x)
            .
            .
            .
        }                        # ...and stop existing here
        x                        # This x still contains 1
     # An example with a procedure
        proc test(x) {
           auto y=2
           z = x + y++           # This z is global
        }
     fmode

C, cmode, func, proc